<script setup>
import {useRouter} from "vue-router";

let router = useRouter()
//从前端存储机制当中获得前端当中存储的用户
let username = window.localStorage.getItem("username")
//声明一个退出的方法
let exit = () => {
    window.localStorage.removeItem("username")
    //转换到新的路径中去
    router.push('/login')
}
</script>

<template>
  <div>
    <h1>项目的首页面Home</h1>
    <h3>欢迎{{ username }}用户的登录</h3>
    <button @click="exit()">退出登录</button>
  </div>
</template>

<style scoped>

</style>